package com.guchenbo.gpark

import com.guchenbo.gpark.gd.{DataGD, GD}

/**
 * @author guchenbo
 * @date 2022/3/21
 */
class GparkContext {

  var name: String = _

  def makeGD[T](data: Seq[T]): GD[T] = {
    new DataGD[T](data, this)
  }

//  def runJob(value: GD[T], func: Seq[T] => Array[T])={
//
//  } = ???

  def runJob[T](gd: GD[T]): Seq[T] = {
    gd.compute()
  }

  override def toString: String = {
    s"[GparkContext] = $name"
  }
}

object GparkContext {

  def apply(): GparkContext = new GparkContext()
}
